home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
powerb5.zip
/
P5UTL003.TIP
< prev
next >
Wrap
Text File
|
1993-06-01
|
2KB
|
76 lines
These days, AUTOEXEC.BAT files are often loaded with
programs to run disk checks, virus checks, and all sorts of
other checks that run when when the computer is switched on.
Some people find this annoying, especially when they're
rebooting in the middle of the day. To keep from being
annoyed more than once a day, I wrote a program in BASIC
called DT.BAS that ensures my PC will do these routine
checks only once a day.
10 OPEN "O",#1,"C:\DT"
20 D$=DATE$
30 PRINT #1,D$
40 CLOSE
50 OPEN "I",#1,"C:\DT"
60 A$=INPUT$(8,#1)
70 ON ERROR GOTO 120
80 OPEN "I",#2,"C:\TODAY"
90 B$=INPUT$(8,#2)
100 IF A$=B$ THEN GOTO 130
110 CLOSE
120 SHELL "CHECK.BAT"
130 SYSTEM
A typical AUTOEXEC.BAT that uses the program is shown below.
Every time the PC is switched on, the program compares the
current date to the date in a file called TODAY. If the date
has changed, i.e., if AUTOEXEC.BAT hasn't run today, my
program will run another batch file, CHECK.BAT; this is
where you put the commands to be run only once a day.
DT.BAS, by the way, won't run properly if it can't find
CHECK.BAT. When CHECK.BAT and DT.BAS are finished,
AUTOEXEC.BAT updates the TODAY file to make sure the batch
will run only once.
P. B. Mohandas
Manama, State of Bahrain
Editor's Note: You don't have to type in Mr. Mohandas' BASIC
program to get it running; it's available as the file
P5UTIL\DT.BAS on your PowerBase *.* Volume 5 diskette. This
solution has an important advantage over others we've
published in previous Star-Dot-Star columns and on our other
PowerBase *.* disks. Some other "one-a-day" schemes stopped
working with the advent of DOS 5.0, but this one, because it
uses a BASIC program, is more immune to changes in DOS. I've
tested it with BASICA and QBASIC, and it runs well with
both, meaning that whatever DOS version you have, you should
be able to run this program.
Here's a sample AUTOEXEC.BAT that uses DT.BAS. If you'd
like, you can export the listing to a batch file using the
Alt-F command, then modify it for your own use.
---- BEGIN LISTING ----
ECHO OFF
PATH=C:\DOS;C:\
PROMPT=$P$G
REM If you're running
REM_DOS 5, use
REM QBASIC /RUN DT
REM instead of
REM the following line.
BASICA C:\DT
COPY C:\DT C:\TODAY
DEL C:\DT
CLS
---- END LISTING ----
Title: A Better One-a-Day Solution
Category: UTL
Issue Date: April, 1992
Editor: Brett Glass
Supplementary Files: P5UTL\DT.BAS
Filename: P5UTL003.TIP